#include<stdio.h>
#define maxn 10017

struct student {
	int id;
	int a, b, c;
	float avg;
} stu[maxn];
int n;

int main() {
	FILE *fout;
	fout = fopen("stud.csv", "w");
	printf("Please enter the number of the students.\n");
	scanf("%d", &n);
	printf("Please enter the corresponding data of the students.\n");
	for(int i = 1; i <= n; i++) {
		scanf("%d%d%d%d", &stu[i].id, &stu[i].a, &stu[i].b, &stu[i].c);
		stu[i].avg = 1.0 * (stu[i].a + stu[i].b +stu[i].c) / 3;
	}
	for(int i = 1; i <= n; i++) {
		fprintf(fout, "%d,%d,%d,%d,%.2f\n", stu[i].id, stu[i].a, stu[i].b, stu[i].c, stu[i].avg);
	}
	fclose(fout);
	return 0;
}